function disc = cal_fun_disc_pscc(eta0,phi,al,d,del,g)
%calibration file recovering sale discount given eta0,phi

options = optimoptions('fsolve','TolFun',1e-9,'TolX',1e-9,'StepTolerance',1e-9,'Display','final');
u=1;be=.95^(1/12);kap0=1;mu0=1;ent=1-(1+g)*(1-d);

%recover steady state
%def of growth: 1+g=(1-del)*(1+al*eta*shat)
eta_shat=((1+g)/(1-del)-1)/al;%given probability of sale, find steady state eta*shat
%eqm condition:1+eta*shat=phi/(phi-1)*el/(1-el) where elasticity satisfies el/(1-el)=1/th^eta0 (see proof of Proposition 2)
th_fun=@(eta0_temp) ((phi/(phi-1))/(1+eta_shat))^(1/eta0_temp);%eqm condition yields implied theta given matching function parameter
th=th_fun(eta0);%evaluate th
shat=eta_shat/eta_pscc(th_fun(eta0),mu0,eta0);%evaluate shat

%corresponding discount
%regular price may be expressed: p^f=u+be*(1-del)*(mu(th)-al)*kap_n(shat)
%discount=(p^f-p^s)/p^f, where p^f-p^s=-kap_n(shat) 
disc=-kap_n_pscc(shat,kap0,phi)/(u+be*(1-d)*(1-del)*(mu_pscc(th,mu0,eta0)-al)*kap_n_pscc(shat,kap0,phi));
end
